package com.zx.notification.producer.config;

import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

/**
 * RocketMQ生产者配置类
 * 用于读取和管理RocketMQ生产者相关的配置参数
 */
@RefreshScope // 支持Nacos的动态刷新功能
@Configuration
@Getter
public class RocketMqProducerConfig {
    /**
     * rocketmq是否启用，控制是否启用rocketmq消息队列功能
     */
    @Value("${spring.rocketmq.enabled:true}")
    private boolean rocketmqEnabled;

    /**
     * RocketMQ NameServer地址，用于连接RocketMQ的NameServer服务
     */
    @Value("${spring.rocketmq.name-server}")
    private String nameServer;

    // Producer配置
    /**
     * RocketMQ生产者组，用于标识生产者属于哪个生产者组
     */
    @Value("${spring.rocketmq.producer.group}")
    private String producerGroup;

    /**
     * RocketMQ生产者发送超时时间(毫秒)，控制消息发送的超时时间
     */
    @Value("${spring.rocketmq.producer.send-message-timeout}")
    private int producerSendMessageTimeout;

    /**
     * RocketMQ生产者发送失败重试次数，当消息发送失败时的重试机制配置
     */
    @Value("${spring.rocketmq.producer.retry-times-when-send-failed}")
    private int producerRetryTimesWhenSendFailed;

}